import { Column } from "@ant-design/plots";
export type weekColumnProps = {
	data: Array<any>;
};
const weekColumn: React.FC<weekColumnProps> = props => {
	const { data } = props;
	const config = {
		data,
		isGroup: true,
		xField: "fieldName",
		yField: "value",
		seriesField: "name",
		/** 设置颜色 */
		color: ["#1890ff", "#f5222d"],
		/** 设置间距 */
		yAxis: {
			grid: {
				line: {
					style: {
						lineWidth: 0
					}
				}
			}
		},
		marginRatio: 0.1,
		label: {
			// 可手动配置 label 数据标签位置
			position: "middle",
			// 'top', 'middle', 'bottom'
			// 可配置附加的布局方法
			layout: [
				// 柱形图数据标签位置自动调整
				{
					type: "interval-adjust-position"
				}, // 数据标签防遮挡
				{
					type: "interval-hide-overlap"
				}, // 数据标签文颜色自动调整
				{
					type: "adjust-color"
				}
			]
		}
	};
	// @ts-ignore
	return <Column style={{ height: "200px" }} {...config} />;
};
export default weekColumn;
